#
#  Copyright 2008 Garth Williams
#
#  This file is part of CommandPost.
#
#  CommandPost is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  CommandPost is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with CommandPost.  If not, see <http://www.gnu.org/licenses/>.
#

class HomeScreenController < ApplicationController
  before_filter :setup
  
  def setup
    @section = 'home'
  end

  def index
    #show the home page wiki section
    @homepage_content = Page.find_by_name('homepage_content')
  
    #show upcoming milestones
    @milestones = Milestone.find(:all, :conditions => ['due_by <= ?', Date.today >> 3], :order => 'due_by')
    
    if logged_in?
      #show recent assignments
      @reports = current_user.reports.find(:limit => 8)
    end
  end
end
